//
//  LZCouponManagerListDetailContentCell.m
//  laziz_Merchant
//
//  Created by xbnzd on 16/12/21.
//  Copyright © 2016年 XBN. All rights reserved.
//

#import "LZCouponManagerListDetailContentCell.h"
#import "GiftListLabel.h"

@interface LZCouponManagerListDetailContentCell()
@property (weak, nonatomic) IBOutlet GiftListLabel *cellContentLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentCellTopCST;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentCellBottomCST;


@end

@implementation LZCouponManagerListDetailContentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self configureLabel];
}

- (UILabel *)getCellContentLabel
{
    return self.cellContentLabel;
}

- (void)setCellName:(NSString *)cellName cellContent:(NSString *)cellContent
{
    if (cellContent.length != 0) {
        [self setContentLabelCellName:cellName cellContent:cellContent];
        
        self.contentCellTopCST.constant = 10;
        self.contentCellBottomCST.constant = 10;
    }else{
        self.contentCellTopCST.constant = 0;
        self.contentCellBottomCST.constant = 0;
    }
}

- (void)setContentLabelCellName:(NSString *)cellName cellContent:(NSString *)cellContent
{
    if (cellContent.length != 0) {
        extern CGFloat textLineSpace;
        NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@   %@",cellName, cellContent]];
        NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
        
        [style setLineSpacing:textLineSpace];
        [style setLineBreakMode:NSLineBreakByWordWrapping];
        
        [attStr addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, attStr.length)];
        [attStr addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0x333333, 1) range:NSMakeRange(0, cellName.length)];
        
        self.cellContentLabel.attributedText = attStr;
    }
}

#pragma mark -
#pragma mark private
- (void)configureLabel
{
    [self.cellContentLabel setVerticalAlignment:VerticalAlignmentTop];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
